/*
 * @author dumeng
 */
'use strict'
import request from '@/utils/request'

/**
 * 获取分类树形列表
 */
export function getClassifyTree(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/craftsmanLibraryClassify/getClassifyTree',
    method: 'POST',
    data
  })
}

/**
 * 获取地区
 */
export function getAreaTree(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/sysRegion/query',
    method: 'post',
    data
  })
}

/**
 * 列表查询
 */
export function queryPage(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/craftsmanLibrary/queryPage',
    method: 'post',
    data
  })
}

/**
 * 新增
 */
export function insert(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/craftsmanLibrary/insert',
    method: 'post',
    data
  })
}

/**
 * 编辑
 */
export function update(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/craftsmanLibrary/update',
    method: 'post',
    data
  })
}

/**
 * 强制下发可修改排序
 */
export function updateSort(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/craftsmanLibrary/updateSort',
    method: 'post',
    data
  })
}

/**
 * 详情
 */
export function get(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/craftsmanLibrary/get',
    method: 'post',
    data
  })
}

/**
 * 删除
 */
export function del(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/craftsmanLibrary/deleteById',
    method: 'post',
    data
  })
}

/**
 * 发布/取消发布
 */
export function updateState(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/craftsmanLibrary/publish',
    method: 'post',
    data
  })
}
/**
 * 置顶/取消置顶
 */
export function updateIsTop(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/craftsmanLibrary/updateTop',
    method: 'post',
    data
  })
}

/**
 * 开关修改
 */
export function set(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/craftsmanLibrary/switchStatusChange',
    method: 'post',
    data
  })
}

/**
 * 统一修改-评分状态
 */
export function setEvaluateState(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/craftsmanLibrary/updateEvaluateState',
    method: 'post',
    data
  })
}

/**
 * 统一修改-点赞状态
 */
export function setFavorState(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/craftsmanLibrary/updateFavorState',
    method: 'post',
    data
  })
}

/**
 * 统一修改-评论状态
 */
export function setCommentState(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/craftsmanLibrary/updateCommentState',
    method: 'post',
    data
  })
}

/**
 * 评论列表
 */
export function queryPage4comment(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/craftsmanLibrary/queryPageComment',
    method: 'post',
    data
  })
}
/**
 * 修改评论状态
 */
export function update4comment(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/craftsmanLibrary/updateCommentStatus',
    method: 'post',
    data
  })
}
/**
 * 查看评论祖先
 */
export function queryPage4commentParent(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/craftsmanLibrary/queryPageCommentParent',
    method: 'post',
    data
  })
}
/**
 * 字典
 */
export function getDictByCode(dictCode) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/sysDictionary/getDictByCode',
    method: 'POST',
    data: {
      dictCode
    }
  })
}
